package com.mgg.goods.controller;

import com.mgg.common.util.ResultVOUtil;
import com.mgg.goods.service.seckill.SecKillService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 秒杀
 * @author lijun
 *
 */
@RestController
@RequestMapping("/seckill")
public class SecKillController {
	
	private Logger log = LoggerFactory.getLogger(getClass());
	
	@Autowired
	private SecKillService secKillService;
	
	/**
	 *
	 * @return
	 * @throws Exception 
	 */
	@GetMapping("/list")
	public Object list() throws Exception {
		return ResultVOUtil.success(secKillService.listTodayActivity());
	}
	
	/**
	 * 
	 * @param seckillId
	 * @return
	 * @throws Exception 
	 */
	@GetMapping("/list/goods")
	public Object gooodList(@RequestParam("id") String seckillId) throws Exception {
		return ResultVOUtil.success(secKillService.listSecKillGoods(seckillId));
	}
}
